package event;

import org.apache.log4j.*;
import SimulationController.StreetControllerAgent;

public class Event implements Runnable {

    static Logger myLogger =
            Logger.getLogger(Event.class.getName());
    Appender myAppender;
    SimpleLayout myLayout;
    public Event siguiente;
    public Event anterior;
    public Event derecho;
    public Event izquierdo;
    public boolean eventoPotencial = false;
    private String name = "";
    public int desiredStatus;
      StreetControllerAgent myStreetControllerAgent;
    public static final int SE = 1; //Stop Event
    public static final int CE = 2;//Cross Event
    public static final int LCE = 3; //Light Change Event
    public static final int CLE = 5; //Change Lane Event
    public static final int CLEE = 6; //Change Lane End Event
    public static final int ALE = 7; //Arrival Link Event
    public static final int LLE = 8; //Leave Link Event
    public static final int BE = 9; //Begin Event
    public static final int AE = 10; //Arrival Event
    public static final int WSE = 11; //Warning Event, as a stop event, but dont stop
    public static final int WBE = 12; // warning Event, as a begin event, but actually for a dont stop event

    /**
     *Identificador de tipo de evento
     *
     *0 CarArrival
     *1	CarStop
     *2	CarCross
     *3 LightChange
     *4 CarStart
     *5 CarCreation
     */
    protected int typeEvent;

    /*
     *identificador de objeto al que esta
     *referenciado este evento
     *recordando que cada evento modifica
     *el estado de algun objeto en mi ambiente.
     */
    protected Object objectId;
    protected String type;
    protected double eventPosition;
    /*Constructor del evento carArrival*/
    /**
     * The event time of this event (when scheduled).
     */
    protected double eventTime = 0;
    /**
     * Regrese el instante en el que se va a ejecutar este evento
     */
    protected int lane;
    

   public Event() {
       PropertyConfigurator.configure("C:\\Users\\emmanuel\\Documents\\NetBeansProjects\\CiudadelaSim\\src\\newproperties.properties");
      
    }

    public Object objectId() {
        return objectId;
    }

    /**
     * Regrese el instante en el que se va a ejecutar este evento
     */
    public double evTime() {
        return eventTime;
    }

    public double evPosition() {
        return eventPosition;
    }

    public int getEventType() {
        return typeEvent;
    }

    public void schedule(final double evTime, final int typeEvent, Object objectId, final double eventPosition, final int desiredStatus, int lane) {

        this.typeEvent = typeEvent;
        this.objectId = objectId;
        this.eventPosition = eventPosition;
        this.eventTime = evTime;
        this.desiredStatus = desiredStatus;
        this.lane = lane;


    }

    public void setTime(double startTime) {
        this.eventTime = startTime;
    }

    @Override
    public String toString() {
        return "nombre evento:" + name;

    }

    public void putName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getDesiredStatus() {
        return this.desiredStatus;
    }

    public int getLane() {
        return this.lane;
    }
   public void putStreetAgent(StreetControllerAgent myStreetControllerAgent) {
        this.myStreetControllerAgent = myStreetControllerAgent;
      
    }
    public void run() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
